import java.util.*;

public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String s = in.nextLine();
            Stack<Character> stack = new Stack<>();
            for(int i = 0;i < s.length();i++) {
                if(stack.isEmpty()) {
                    stack.add(s.charAt(i));
                    continue;
                }
                if(stack.peek().equals(s.charAt(i))) {
                    stack.pop();
                }else {
                    stack.add(s.charAt(i));
                }
            }
            if(stack.isEmpty()) {
                System.out.println(0);
            }
            StringBuffer ret = new StringBuffer();
            while(!stack.isEmpty()) {
                ret.append(stack.pop());
            }
            StringBuffer ans = new StringBuffer();
            for (int i = ret.length()-1; i >= 0; i--) {
                ans.append(ret.charAt(i));
            }
            System.out.println(ans.toString());
        }
    }
}
